<html>
<head>
  <title>18-事务简介</title>
  <basefont face="微软雅黑" size="2" />
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  <meta name="exporter-version" content="YXBJ Windows/600646 (zh-CN, DDL); Windows/6.1.1 (Win64);"/>
  <meta name="content-class" content="yinxiang.markdown"/>
  <style>
    body, td {
      font-family: 微软雅黑;
      font-size: 10pt;
    }
  </style>
</head>
<body>
<a name="925"/>
<h1>18-事务简介</h1>

<div><span><div style="font-size: 14px; margin: 0; padding: 0; width: 100%;"><p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">事务（transaction）</strong>：把需要保证原子性、隔离性、一致性和持久性的一个或多个数据库操作称之为一个事务（英文名是：transaction）。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">数据库事务的四大特性（ACID）</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">ACID</strong>，指数据库事务正确执行的四个基本要素的缩写。包含：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">原子性（Atomicity）</strong>、<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一致性（Consistency）</strong>、<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隔离性（Isolation）</strong>、<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">持久性（Durability）</strong>。一个支持事务（Transaction）的数据库，必需要具有这四种特性，否则在事务过程（Transaction processing）当中无法保证数据的正确性，交易过程极可能达不到交易方的要求。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">原子性（Atomicity）</strong><br/>
原子性是指事务是一个不可分割的工作单位，事务中的操作要么都发生，要么都不发生。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一致性（Consistency）</strong><br/>
如果事务执行之前数据库是一个完整的状态，那么事务结束后，无论事务是否执行成功，数据库仍然是一个完整的状态。　　<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">数据库的完整状态</strong>：当一个数据库中的所有的数据都符合数据库中所定义的所有约束，此时可以称数据库是一个完整的状态。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隔离性（Isolation）</strong><br/>
多个用户并发访问数据库时，一个用户的事务不能被其他用户的事务所干扰，多个并发事务之间数据要相互隔离。</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">持久性（Durability）</strong><br/>
指一个事务一旦被提交，对数据库的影响是永久性的，即转换的结果永久保留。</p>
</li>
</ul>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">事务的状态</h2>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">事务是一个抽象的概念，它其实对应着一个或多个数据库操作，根据这些操作所执行的不同阶段把事务大致上划分为几个状态：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">活动（active）</strong><br/>
事务对应的数据库操作正在执行过程中，此时事务处在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">活动</strong>状态；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">部分提交（partially committed）</strong><br/>
当事务中的最后一个操作执行完成，但由于操作都在内存中执行，所造成的影响并没有刷新到磁盘时，此时事务处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">部分提交</strong>状态；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">失败（failed）</strong><br/>
当事务处在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">活动</strong>或者<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">部分提交</strong>状态时，可能遇到某些错误（数据库自身的错误、操作体统错误或者直接断电等）而无法继续执行，或者人为的停止当前事务的执行，此时事务处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">失败</strong>状态；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">中止（aborted）</strong><br/>
处在<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">失败</strong>状态的事务，为保证数据库的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">原子性和一致性</strong>，要撤销失败事务对当前数据库造成的影响，这个撤销的过程称之为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">回滚</strong>。当回滚操作执行完毕时，也就是数据库恢复到了执行事务之前的状态，此时事务处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">中止</strong>状态；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">提交（committed）</strong><br/>
当一个处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">部分提交</strong>状态的事务将修改过的数据都同步在磁盘上之后，此时事务处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">提交</strong>状态。</p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">随着事务对应的数据库操作执行到不同阶段，事务的状态也在不断变化，一个基本的状态转换图如下所示：<img src="18-事务简介_files/1.jpg" type="image/jpeg" data-filename="1.jpg"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">只有当事务处于<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">提交</strong>的或者<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">中止</strong>的状态时，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">一个事务的生命周期才算是结束了</strong>。对于已经提交的事务来说，该事务对数据库所做的修改将永久生效，对于处于中止状态的事务，该事务对数据库所做的所有修改都会被回滚到没执行该事务之前的状态。</p>
<h2 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 34px; border-bottom: 1px solid #dbdbdb; color: #333;">MySQL中事务的语法</h2>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">开启事务</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">开启事务有两种语句：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">begin[work]；</strong><br/>
BEGIN语句代表开启一个事务，后边的单词WORK可有可无。开启事务后，就可以继续写若干条语句，这些语句都属于刚刚开启的这个事务。<img src="18-事务简介_files/Image.png" type="image/png" data-filename="Image.png"/></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">start transaction；</strong><br/>
START TRANSACTION语句和BEGIN语句有着相同的功效，都标志着开启一个事务，比如这样：<img src="18-事务简介_files/Image [1].png" type="image/png" data-filename="Image.png"/><br/>
不过比BEGIN语句牛逼一点儿的是，可以在START TRANSACTION语句后边跟随几个<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">修饰符</strong>：<br/>
a. <strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">read only</strong>：标识当前事务是一个只读事务，也就是属于该事务的数据库操作只能读取数据，而不能修改数据；<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">其实只读事务中只是不允许修改那些其他事务也能访问到的表中的数据，对于临时表来说（我们使用CREATE TMEPORARY TABLE创建的表），由于它们只能在当前会话中可见，所以只读事务其实也是可以对临时表进行增、删、改操作的。</strong><br/>
b. <strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">read write</strong>：标识当前事务是一个读写事务，也就是属于该事务的数据库操作既可以读取数据，也可以修改数据；<br/>
c. <strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">with consistent snapshot</strong>：启动一致性读；<br/>
如果想在START TRANSACTION后边跟随<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">多个修饰符</strong>的话，可以使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">逗号将修饰符分开</strong>，比如开启一个只读事务和一致性读，就可以这样写：<img src="18-事务简介_files/Image [2].png" type="image/png" data-filename="Image.png"/><br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">READ ONLY和READ WRITE</strong>是用来设置所谓的事务<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">访问模式</strong>的，就是以只读还是读写的方式来访问数据库中的数据，一个事务的访问模式不能同时既设置为只读的也设置为读写的，所以我们不能同时把READ ONLY和READ WRITE放到START TRANSACTION语句后边。另外，如果不显式指定事务的访问模式，那么该事务的访问模式就是<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">读写模式</strong>。</p>
</li>
</ul>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">提交事务</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">语法：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">commit [work]；</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">COMMIT语句就代表提交一个事务，后边的WORK可有可无。比如我们上边说狗哥给猫爷转10元钱其实对应MySQL中的两条语句，我们就可以把这两条语句放到一个事务中，完整的过程就是这样：<br/>
<img src="18-事务简介_files/Image [3].png" type="image/png" data-filename="Image.png"/></p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">手动中止事务</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果写了几条语句之后发现上边的某条语句写错了，可以手动的使用下边这个语句来将数据库恢复到事务执行之前的样子：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">rollback [work]</strong></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;"><strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">rollback语句</strong>是程序员<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">手动的去回滚事务</strong>时才去使用的，如果事务在执行过程中遇到了某些<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">错误而无法继续执行</strong>的话，事务自身会<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">自动回滚</strong>。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">支持事务的存储引擎</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">MySQL目前只有InnoDB和NDB存储引擎支持事务。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">自动提交</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">MySQL中有一个系统变量来控制事务是否自动提交：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">autocommit</strong><br/>
<img src="18-事务简介_files/Image [4].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">可以看到它的默认值为ON，也就是说默认情况下，如果我们不显式的使用START TRANSACTION或者BEGIN语句开启一个事务，那么每一条语句都算是一个独立的事务，这种特性称之为事务的自动提交。假如我们在狗哥向猫爷转账10元时不以START TRANSACTION或者BEGIN语句显式的开启一个事务，那么下边这两条语句就相当于放到两个独立的事务中去执行：<img src="18-事务简介_files/Image [5].png" type="image/png" data-filename="Image.png"/></p>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">当然，如果我们想关闭这种自动提交的功能，可以使用下边两种方法之一：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">显式的的使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">start transaction</strong>或者<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">begin</strong>语句开启一个事务<br/>
这样在本次事务提交或者回滚前会暂时关闭掉自动提交的功能；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">把系统变量autocommit的值设置为<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">OFF</strong>，就像这样：<br/>
<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">set autocommit = OFF</strong>或者<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">set autocommit = 0</strong></p>
</li>
</ul>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">这样写入的多条语句就算是属于同一个事务了，直到显式的写出COMMIT语句来把这个事务提交掉，或者显式的写出ROLLBACK语句来把这个事务回滚掉。</p>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">隐式提交</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">当使用START TRANSACTION或者BEGIN语句开启了一个事务，或者把系统变量autocommit的值设置为OFF时，事务就不会进行自动提交，但是如果输入了某些语句之后就会悄悄的提交掉，就像我们输入了COMMIT语句了一样，这种因为某些特殊的语句而导致事务提交的情况称为隐式提交，这些会导致事务<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">隐式提交</strong>的语句包括：</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">定义或修改数据库对象的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">数据定义语言</strong>（Data definition language，缩写为：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">DDL</strong>）<br/>
所谓的数据库对象，指的就是数据库、表、视图、存储过程等等这些东西。当我们使用CREATE、ALTER、DROP等语句去修改这些所谓的数据库对象时，就会隐式的提交前边语句所属于的事务；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">隐式使用或修改mysql数据库中的表<br/>
当使用ALTER USER、CREATE USER、DROP USER、GRANT、RENAME USER、REVOKE、SET PASSWORD等语句时也会隐式的提交前边语句所属于的事务；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">事务控制或关于锁定的语句<br/>
当在一个事务还没提交或者回滚时就又使用START TRANSACTION或者BEGIN语句<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">开启了另一个事务</strong>时，会隐式的提交上一个事务；<br/>
或者当前的<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">autocommit系统变量的值为OFF</strong>，<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">手动把它调为ON时</strong>，也会隐式的提交前边语句所属的事务；<br/>
或者使用<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">LOCK TABLES、UNLOCK TABLES</strong>等关于锁定的语句也会隐式的提交前边语句所属的事务；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">加载数据的语句<br/>
比如使用LOAD DATA语句来批量往数据库中导入数据时，也会隐式的提交前边语句所属的事务；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">关于MySQL复制的一些语句<br/>
使用START SLAVE、STOP SLAVE、RESET SLAVE、CHANGE MASTER TO等语句时也会隐式的提交前边语句所属的事务；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">其它的一些语句<br/>
使用ANALYZE TABLE、CACHE INDEX、CHECK TABLE、FLUSH、 LOAD INDEX INTO CACHE、OPTIMIZE TABLE、REPAIR TABLE、RESET等语句也会隐式的提交前边语句所属的事务。</p>
</li>
</ul>
<h3 style="line-height: 160%; box-sizing: content-box; font-weight: 700; font-size: 27px; color: #333;">保存点</h3>
<p style="line-height: 160%; box-sizing: content-box; margin: 10px 0; color: #333;">如果启了一个事务，并且已经敲了很多语句，忽然发现上一条语句有点问题，只好使用ROLLBACK语句来让数据库状态恢复到事务执行之前的样子，然后一切从头再来，总有一种一夜回到解放前的感觉。所以MySQL提出了一个**保存点（英文：savepoint）**的概念，就是在事务对应的数据库语句中打几个点，在调用ROLLBACK语句时可以指定会滚到哪个点，而不是回到最初的原点。</p>
<ul style="line-height: 160%; box-sizing: content-box; display: block; list-style-type: disc; padding-left: 30px; margin: 6px 0 10px; color: #333;">
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">定义保存点：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">savepoint 保存点名称；</strong></p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">回滚到保存点：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">rollback [work] to [savepoint] 保存点名称；</strong><br/>
如果<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">rollback语句后不跟保存点名称的话，事务会直接回滚到执行之前的状态</strong>；</p>
</li>
<li style="line-height: 160%; box-sizing: content-box; position: relative;">
<p style="line-height: 160%; box-sizing: content-box; color: #333; margin: 0;">删除保存点：<strong style="line-height: 160%; box-sizing: content-box; font-weight: 700;">release savepoint bao'c</strong></p>
</li>
</ul>
</div><center style="display:none !important;visibility:collapse !important;height:0 !important;white-space:nowrap;width:100%;overflow:hidden">%0A**%E4%BA%8B%E5%8A%A1%EF%BC%88transaction%EF%BC%89**%EF%BC%9A%E6%8A%8A%E9%9C%80%E8%A6%81%E4%BF%9D%E8%AF%81%E5%8E%9F%E5%AD%90%E6%80%A7%E3%80%81%E9%9A%94%E7%A6%BB%E6%80%A7%E3%80%81%E4%B8%80%E8%87%B4%E6%80%A7%E5%92%8C%E6%8C%81%E4%B9%85%E6%80%A7%E7%9A%84%E4%B8%80%E4%B8%AA%E6%88%96%E5%A4%9A%E4%B8%AA%E6%95%B0%E6%8D%AE%E5%BA%93%E6%93%8D%E4%BD%9C%E7%A7%B0%E4%B9%8B%E4%B8%BA%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%88%E8%8B%B1%E6%96%87%E5%90%8D%E6%98%AF%EF%BC%9Atransaction%EF%BC%89%E3%80%82%0A%0A%23%23%20%E6%95%B0%E6%8D%AE%E5%BA%93%E4%BA%8B%E5%8A%A1%E7%9A%84%E5%9B%9B%E5%A4%A7%E7%89%B9%E6%80%A7%EF%BC%88ACID%EF%BC%89%0A%0A**ACID**%EF%BC%8C%E6%8C%87%E6%95%B0%E6%8D%AE%E5%BA%93%E4%BA%8B%E5%8A%A1%E6%AD%A3%E7%A1%AE%E6%89%A7%E8%A1%8C%E7%9A%84%E5%9B%9B%E4%B8%AA%E5%9F%BA%E6%9C%AC%E8%A6%81%E7%B4%A0%E7%9A%84%E7%BC%A9%E5%86%99%E3%80%82%E5%8C%85%E5%90%AB%EF%BC%9A**%E5%8E%9F%E5%AD%90%E6%80%A7%EF%BC%88Atomicity%EF%BC%89**%E3%80%81**%E4%B8%80%E8%87%B4%E6%80%A7%EF%BC%88Consistency%EF%BC%89**%E3%80%81**%E9%9A%94%E7%A6%BB%E6%80%A7%EF%BC%88Isolation%EF%BC%89**%E3%80%81**%E6%8C%81%E4%B9%85%E6%80%A7%EF%BC%88Durability%EF%BC%89**%E3%80%82%E4%B8%80%E4%B8%AA%E6%94%AF%E6%8C%81%E4%BA%8B%E5%8A%A1%EF%BC%88Transaction%EF%BC%89%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%EF%BC%8C%E5%BF%85%E9%9C%80%E8%A6%81%E5%85%B7%E6%9C%89%E8%BF%99%E5%9B%9B%E7%A7%8D%E7%89%B9%E6%80%A7%EF%BC%8C%E5%90%A6%E5%88%99%E5%9C%A8%E4%BA%8B%E5%8A%A1%E8%BF%87%E7%A8%8B%EF%BC%88Transaction%20processing%EF%BC%89%E5%BD%93%E4%B8%AD%E6%97%A0%E6%B3%95%E4%BF%9D%E8%AF%81%E6%95%B0%E6%8D%AE%E7%9A%84%E6%AD%A3%E7%A1%AE%E6%80%A7%EF%BC%8C%E4%BA%A4%E6%98%93%E8%BF%87%E7%A8%8B%E6%9E%81%E5%8F%AF%E8%83%BD%E8%BE%BE%E4%B8%8D%E5%88%B0%E4%BA%A4%E6%98%93%E6%96%B9%E7%9A%84%E8%A6%81%E6%B1%82%E3%80%82%0A%0A*%20**%E5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%20committed%EF%BC%89**%0A%E5%BD%93%E4%BA%8B%E5%8A%A1%E4%B8%AD%E7%9A%84%E6%9C%80%E5%90%8E%E4%B8%80%E4%B8%AA%E6%93%8D%E4%BD%9C%E6%89%A7%E8%A1%8C%E5%AE%8C%E6%88%90%EF%BC%8C%E4%BD%86%E7%94%B1%E4%BA%8E%E6%93%8D%E4%BD%9C%E9%83%BD%E5%9C%A8%E5%86%85%E5%AD%98%E4%B8%AD%E6%89%A7%E8%A1%8C%EF%BC%8C%E6%89%80%E9%80%A0%E6%88%90%E7%9A%84%E5%BD%B1%E5%93%8D%E5%B9%B6%E6%B2%A1%E6%9C%89%E5%88%B7%E6%96%B0%E5%88%B0%E7%A3%81%E7%9B%98%E6%97%B6%EF%BC%8C%E6%AD%A4%E6%97%B6%E4%BA%8B%E5%8A%A1%E5%A4%84%E4%BA%8E**%E9%83%A8%E5%88%86%E6%8F%90%E4%BA%A4**%E7%8A%B6%E6%80%81%EF%BC%9B%0A%0A*%20**%E5%A4%B1%E8%B4%A5%EF%BC%88failed%EF%BC%89**%0A%E5%BD%93%E4%BA%8B%E5%8A%A1%E5%A4%84%E5%9C%A8**%E6%B4%BB%E5%8A%A8**%E6%88%96%E8%80%85**%E9%83%A8%E5%88%86%E6%8F%90%E4%BA%A4**%E7%8A%B6%E6%80%81%E6%97%B6%EF%BC%8C%E5%8F%AF%E8%83%BD%E9%81%87%E5%88%B0%E6%9F%90%E4%BA%9B%E9%94%99%E8%AF%AF%EF%BC%88%E6%95%B0%E6%8D%AE%E5%BA%93%E8%87%AA%E8%BA%AB%E7%9A%84%E9%94%99%E8%AF%AF%E3%80%81%E6%93%8D%E4%BD%9C%E4%BD%93%E7%BB%9F%E9%94%99%E8%AF%AF%E6%88%96%E8%80%85%E7%9B%B4%E6%8E%A5%E6%96%AD%E7%94%B5%E7%AD%89%EF%BC%89%E8%80%8C%E6%97%A0%E6%B3%95%E7%BB%A7%E7%BB%AD%E6%89%A7%E8%A1%8C%EF%BC%8C%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1%E6%9C%89%E4%B8%A4%E7%A7%8D%E8%AF%AD%E5%8F%A5%EF%BC%9A%0A%0A*%20**begin%5Bwork%5D%EF%BC%9B**%0ABEGIN%E8%AF%AD%E5%8F%A5%E4%BB%A3%E8%A1%A8%E5%BC%80%E5%90%AF%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8C%E5%90%8E%E8%BE%B9%E7%9A%84%E5%8D%95%E8%AF%8DWORK%E5%8F%AF%E6%9C%89%E5%8F%AF%E6%97%A0%E3%80%82%E5%BC%80%E5%90%AF%E4%BA%8B%E5%8A%A1%E5%90%8E%EF%BC%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%BB%A7%E7%BB%AD%E5%86%99%E8%8B%A5%E5%B9%B2%E6%9D%A1%E8%AF%AD%E5%8F%A5%EF%BC%8C%E8%BF%99%E4%BA%9B%E8%AF%AD%E5%8F%A5%E9%83%BD%E5%B1%9E%E4%BA%8E%E5%88%9A%E5%88%9A%E5%BC%80%E5%90%AF%E7%9A%84%E8%BF%99%E4%B8%AA%E4%BA%8B%E5%8A%A1%E3%80%82!%5B80e11c08842f6c6f4685f8de9122ea45.png%5D(en-resource%3A%2F%2Fdatabase%2F929%3A0)%0A%0A*%20**start%20transaction%EF%BC%9B**%0ASTART%20TRANSACTION%E8%AF%AD%E5%8F%A5%E5%92%8CBEGIN%E8%AF%AD%E5%8F%A5%E6%9C%89%E7%9D%80%E7%9B%B8%E5%90%8C%E7%9A%84%E5%8A%9F%E6%95%88%EF%BC%8C%E9%83%BD%E6%A0%87%E5%BF%97%E7%9D%80%E5%BC%80%E5%90%AF%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8C%E6%AF%94%E5%A6%82%E8%BF%99%E6%A0%B7%EF%BC%9A!%5B48cc284cb0ea8ff7842886641c497925.png%5D(en-resource%3A%2F%2Fdatabase%2F931%3A0)%0A%E4%B8%8D%E8%BF%87%E6%AF%94BEGIN%E8%AF%AD%E5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E5%9C%A8%E6%89%A7%E8%A1%8C%E8%BF%87%E7%A8%8B%E4%B8%AD%E9%81%87%E5%88%B0%E4%BA%86%E6%9F%90%E4%BA%9B**%E9%94%99%E8%AF%AF%E8%80%8C%E6%97%A0%E6%B3%95%E7%BB%A7%E7%BB%AD%E6%89%A7%E8%A1%8C**%E7%9A%84%E8%AF%9D%EF%BC%8C%E4%BA%8B%E5%8A%A1%E8%87%AA%E8%BA%AB%E4%BC%9A**%E8%87%AA%E5%8A%A8%E5%9B%9E%E6%BB%9A**%E3%80%82%0A%0A%23%23%23%20%E6%94%AF%E6%8C%81%E4%BA%8B%E5%8A%A1%E7%9A%84%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%0AMySQL%E7%9B%AE%E5%89%8D%E5%8F%AA%E6%9C%89InnoDB%E5%92%8CNDB%E5%AD%98%E5%82%A8%E5%BC%95%E6%93%8E%E6%94%AF%E6%8C%81%E4%BA%8B%E5%8A%A1%E3%80%82%0A%0A%23%23%23%20%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%0AMySQL%E4%B8%AD%E6%9C%89%E4%B8%80%E4%B8%AA%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8F%E6%9D%A5%E6%8E%A7%E5%88%B6%E4%BA%8B%E5%8A%A1%E6%98%AF%E5%90%A6%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%EF%BC%9A**autocommit**%0A!%5Bd9ff26853665d11bb29f52458d38c491.png%5D(en-resource%3A%2F%2Fdatabase%2F937%3A0)%0A%0A%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E5%AE%83%E7%9A%84%E9%BB%98%E8%AE%A4%E5%80%BC%E4%B8%BAON%EF%BC%8C%E4%B9%9F%E5%B0%B1%E6%98%AF%E8%AF%B4%E9%BB%98%E8%AE%A4%E6%83%85%E5%86%B5%E4%B8%8B%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E4%B8%8D%E6%98%BE%E5%BC%8F%E7%9A%84%E4%BD%BF%E7%94%A8START%20TRANSACTION%E6%88%96%E8%80%85BEGIN%E8%AF%AD%E5%8F%A5%E5%BC%80%E5%90%AF%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8C%E9%82%A3%E4%B9%88%E6%AF%8F%E4%B8%80%E6%9D%A1%E8%AF%AD%E5%8F%A5%E9%83%BD%E7%AE%97%E6%98%AF%E4%B8%80%E4%B8%AA%E7%8B%AC%E7%AB%8B%E7%9A%84%E4%BA%8B%E5%8A%A1%EF%BC%8C%E8%BF%99%E7%A7%8D%E7%89%B9%E6%80%A7%E7%A7%B0%E4%B9%8B%E4%B8%BA%E4%BA%8B%E5%8A%A1%E7%9A%84%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E3%80%82%E5%81%87%E5%A6%82%E6%88%91%E4%BB%AC%E5%9C%A8%E7%8B%97%E5%93%A5%E5%90%91%E7%8C%AB%E7%88%B7%E8%BD%AC%E8%B4%A610%E5%85%83%E6%97%B6%E4%B8%8D%E4%BB%A5START%20TRANSACTION%E6%88%96%E8%80%85BEGIN%E8%AF%AD%E5%8F%A5%E6%98%BE%E5%BC%8F%E7%9A%84%E5%BC%80%E5%90%AF%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%EF%BC%8C%E9%82%A3%E4%B9%88%E4%B8%8B%E8%BE%B9%E8%BF%99%E4%B8%A4%E6%9D%A1%E8%AF%AD%E5%8F%A5%E5%B0%B1%E7%9B%B8%E5%BD%93%E4%BA%8E%E6%94%BE%E5%88%B0%E4%B8%A4%E4%B8%AA%E7%8B%AC%E7%AB%8B%E7%9A%84%E4%BA%8B%E5%8A%A1%E4%B8%AD%E5%8E%BB%E6%89%A7%E8%A1%8C%EF%BC%9A!%5Becf8368ccbf14af9b996078644ced1b9.png%5D(en-resource%3A%2F%2Fdatabase%2F939%3A0)%0A%0A%E5%BD%93%E7%84%B6%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E6%83%B3%E5%85%B3%E9%97%AD%E8%BF%99%E7%A7%8D%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E7%9A%84%E5%8A%9F%E8%83%BD%EF%BC%8C%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8%E4%B8%8B%E8%BE%B9%E4%B8%A4%E7%A7%8D%E6%96%B9%E6%B3%95%E4%B9%8B%E4%B8%80%EF%BC%9A%0A%0A*%20%E6%98%BE%E5%BC%8F%E7%9A%84%E7%9A%84%E4%BD%BF%E7%94%A8**start%20transaction**%E6%88%96%E8%80%85**begin**%E8%AF%AD%E5%8F%A5%E5%BC%80%E5%90%AF%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%0A%E8%BF%99%E6%A0%B7%E5%9C%A8%E6%9C%AC%E6%AC%A1%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4%E6%88%96%E8%80%85%E5%9B%9E%E6%BB%9A%E5%89%8D%E4%BC%9A%E6%9A%82%E6%97%B6%E5%85%B3%E9%97%AD%E6%8E%89%E8%87%AA%E5%8A%A8%E6%8F%90%E4%BA%A4%E7%9A%84%E5%8A%9F%E8%83%BD%EF%BC%9B%0A%0A*%20%E6%8A%8A%E7%B3%BB%E7%BB%9F%E5%8F%98%E9%87%8Fautocommit%E7%9A%84%E5%80%BC%E8%AE%BE%E7%BD%AE%E4%B8%BA**OFF**%EF%BC%8C%E5%B0%B1%E5%83%8F%E8%BF%99%E6%A0%B7%EF%BC%9A%0A**set%20autocommit%20%3D%20OFF**%E6%88%96%E8%80%85**set%20autocommit%20%3D%200**%0A%0A%E8%BF%99%E6%A0%B7%E5%86%99%E5%85%A5%E7%9A%84%E5%A4%9A%E6%9D%A1%E8%AF%AD%E5%8F%A5%E5%B0%B1%E7%AE%97%E6%98%AF%E5%B1%9E%E4%BA%8E%E5%90%8C%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E4%BA%86%EF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B%E4%BF%AE%E6%94%B9%E8%BF%99%E4%BA%9B%E6%89%80%E8%B0%93%E7%9A%84%E6%95%B0%E6%8D%AE%E5%BA%93%E5%AF%B9%E8%B1%A1%E6%97%B6%EF%BC%8C%E5%B0%B1%E4%BC%9A%E9%9A%90%E5%BC%8F%E7%9A%84%E6%8F%90%E4%BA%A4%E5%89%8D%E8%BE%B9%E8%AF%AD%E5%8F%A5%E6%89%80%E5%B1%9E%E4%BA%8E%E7%9A%84%E4%BA%8B%E5%8A%A1%EF%BC%9B%0A%0A*%20%E9%9A%90%E5%BC%8F%E4%BD%BF%E7%94%A8%E6%88%96%E4%BF%AE%E6%94%B9mysql%E6%95%B0%E6%8D%AE%E5%BA%93%E4%B8%AD%E7%9A%84%E8%A1%A8%0A%E5%BD%93%E4%BD%BF%E7%94%A8ALTER%20USER%E3%80%81CREATE%20USER%E3%80%81DROP%20USER%E3%80%81GRANT%E3%80%81RENAME%20USER%E3%80%81REVOKE%E3%80%81SET%20PASSWORD%E7%AD%89%E8%AF%AD%E5%8F%A5%E6%97%B6%E4%B9%9F%E4%BC%9A%E9%9A%90%E5%BC%8F%E7%9A%84%E6%8F%90%E4%BA%A4%E5%89%8D%E8%BE%B9%E8%AF%AD%E5%8F%A5%E6%89%80%E5%B1%9E%E4%BA%8E%E7%9A%84%E4%BA%8B%E5%8A%A1%EF%BC%9B%0A%0A*%20%E4%BA%8B%E5%8A%A1%E6%8E%A7%E5%88%B6%E6%88%96%E5%85%B3%E4%BA%8E%E9%94%81%E5%AE%9A%E7%9A%84%E8%AF%AD%E5%8F%A5%0A%E5%BD%93%E5%9C%A8%E4%B8%80%E4%B8%AA%E4%BA%8B%E5%8A%A1%E8%BF%98%E6%B2%A1%E6%8F%90%E4%BA%A4%E6%88%96%E8%80%85%E5%9B%9E%E6%BB%9A%E6%97%B6%E5%B0%B1%E5%8F%88%E4%BD%BF%E7%94%A8START%20TRANSACTION%E6%88%96%E8%80%85BEGIN%E8%AF%AD%E5%8F%A5**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95%B0%E6%8D%AE%E6%97%B6%EF%BC%8C%E4%B9%9F%E4%BC%9A%E9%9A%90%E5%BC%8F%E7%9A%84%E6%8F%90%E4%BA%A4%E5%89%8D%E8%BE%B9%E8%AF%AD%E5%8F%A5%E6%89%80%E5%B1%9E%E7%9A%84%E4%BA%8B%E5%8A%A1%EF%BC%9B%0A%0A*%20%E5%85%B3%E4%BA%8EMySQL%E5%A4%8D%E5%88%B6%E7%9A%84%E4%B8%80%E4%BA%9B%E8%AF%AD%E5%8F%A5%0A%E4%BD%BF%E7%94%A8START%20SLAVE%E3%80%81STOP%20SLAVE%E3%80%81RESET%20SLAVE%E3%80%81CHANGE%20MASTER%20TO%E7%AD%89%E8%AF%AD%E5%8F%A5%E6%97%B6%E4%B9%9F%E4%BC%9A%E9%9A%90%E5%BC%8F%E7%9A%84%E6%8F%90%E4%BA%A4%E5%89%8D%E8%BE%B9%E8%AF%AD%E5%8F%A5%E6%89%80%E5%B1%9E%E7%9A%84%E4%BA%8B%E5%8A%A1%EF%BC%9B%0A%0A*%20%E5%85%B6%E5%AE%83%E7%9A%84%E4%B8%80%E4%BA%9B%E8%AF%AD%E5%8F%A5%0A%E4%BD%BF%E7%94%A8ANALYZE%20TABLE%E3%80%81CACHE%20INDEX%E3%80%81CHECK%20TABLE%E3%80%81FLUSH%E3%80%81%C2%A0LOAD%20INDEX%20INTO%20CACHE%E3%80%81OPTIMIZE%20TABLE%E3%80%81REPAIR%20TABLE%E3%80%81RESET%E7%AD%89%E8%AF%AD%E5%8F%A5%E4%B9%9F%E4%BC%9A%E9%9A%90%E5%BC%8F%E7%9A%84%E6%8F%90%E4%BA%A4%E5%89%8D%E8%BE%B9%E8%AF%AD%E5%8F%A5%E6%89%80%E5%B1%9E%E7%9A%84%E4%BA%8B%E5%8A%A1%E3%80%82%0A%0A%0A%23%23%23%20%E4%BF%9D%E5%AD%98%E7%82%B9%0A%E5%A6%82%E6%9E%9C%E5%90%AF%E4%BA%86%E4%B8%80%E4%B8%AA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ROLLBACK%E8%AF%AD%E5%8F%A5%E6%97%B6%E5%8F%AF%E4%BB%A5%E6%8C%87%E5%AE%9A%E4%BC%9A%E6%BB%9A%E5%88%B0%E5%93%AA%E4%B8%AA%E7%82%B9%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E5%9B%9E%E5%88%B0%E6%9C%80%E5%88%9D%E7%9A%84%E5%8E%9F%E7%82%B9%E3%80%82%0A%0A*%20%E5%AE%9A%E4%B9%89%E4%BF%9D%E5%AD%98%E7%82%B9%EF%BC%9A**savepoint%20%E4%BF%9D%E5%AD%98%E7%82%B9%E5%90%8D%E7%A7%B0%EF%BC%9B**%0A%0A%0A*%20%E5%9B%9E%E6%BB%9A%E5%88%B0%E4%BF%9D%E5%AD%98%E7%82%B9%EF%BC%9A**rollback%20%5Bwork%5D%20to%20%5Bsavepoint%5D%20%E4%BF%9D%E5%AD%98%E7%82%B9%E5%90%8D%E7%A7%B0%EF%BC%9B**%0A%E5%A6%82%E6%9E%9C**rollback%E8%AF%AD%E5%8F%A5%E5%90%8E%E4%B8%8D%E8%B7%9F%E4%BF%9D%E5%AD%98%E7%82%B9%E5%90%8D%E7%A7%B0%E7%9A%84%E8%AF%9D%EF%BC%8C%E4%BA%8B%E5%8A%A1%E4%BC%9A%E7%9B%B4%E6%8E%A5%E5%9B%9E%E6%BB%9A%E5%88%B0%E6%89%A7%E8%A1%8C%E4%B9%8B%E5%89%8D%E7%9A%84%E7%8A%B6%E6%80%81**%EF%BC%9B%0A%0A*%20%E5%88%A0%E9%99%A4%E4%BF%9D%E5%AD%98%E7%82%B9%EF%BC%9A**release%20savepoint%20%E4%BF%9D%E5%AD%98%E7%82%B9%E5%90%8D%E7%A7%B0%EF%BC%9B**%0A</center></span>
</div></body></html> 